import { request } from "@/utils/service"
import type {
  PayProductsData, PayProductsReqData,
  PayProductsReqListData,
  PayProductsReqPageData, PayProductsRespListData,
  PayProductsRespPageData
} from "@/api/products/types";



// 创建商品
export function createPayProducts(data: PayProductsData) {
  return request({
    url: '/private/pay/pay-products/create',
    method: 'POST',
    data: data
  })
}

// 更新商品
export function updatePayProducts(data: PayProductsData) {
  return request({
    url: '/private/pay/pay-products/update',
    method: 'PUT',
    data: data
  })
}

// 删除商品
export function deletePayProducts(id: string) {
  return request({
    url: '/private/pay/pay-products/delete?id=' + id,
    method: 'DELETE'
  })
}

// 获得商品
export function getPayProducts(id?: string) {
  return request<PayProductsData>({
    url: '/private/pay/pay-products/get?id=' + id,
    method: 'GET'
  })
}

// 获得商品分页
export function getPayProductsPage(query: PayProductsReqPageData) {
  return request<PayProductsRespPageData>({
    url: '/private/pay/pay-products/page',
    method: 'GET',
    data: query
  })
}

// 获得商品列表
export function getPayProductsList(query: PayProductsReqListData) {
  return request<PayProductsRespListData>({
    url: '/private/pay/pay-products/list',
    method: 'GET',
    data: query
  })
}


// 导出商品 Excel
export function exportPayProductsExcel(query: PayProductsReqData) {
  return request({
    url: '/private/pay/pay-products/export-excel',
    method: 'GET',
    data: query,
    responseType: 'blob'
  })
}
